package com.flow.asyncflow.test;


import com.flow.asyncflow.core.entity.autooperation.AutoOperationAbstract;
import com.flow.asyncflow.core.enums.PageNumberEnum;
import com.flow.asyncflow.test.asyncflow.context.plusasyncflowtest.PlusAsyncFlowTestContext;
import com.flow.asyncflow.test.asyncflow.model.plusasyncflowtest.PlusAsyncFlowTestRequest;
import com.flow.asyncflow.test.asyncflow.model.plusasyncflowtest.PlusAsyncFlowTestResponse;
import com.flow.asyncflow.test.asyncflow.operatorenum.asyncflowtest.PlusAsyncFlowTestOperatorEnum;
import com.flow.asyncflow.test.manager.asyncflowtest.PlusAsyncFlowTestManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/AsyncFlowTest")
public class AsyncFlowTestController extends AutoOperationAbstract {


    @Autowired
    private PlusAsyncFlowTestManager plusAsyncFlowTestManager;

    @GetMapping("Test")
    public String test() throws IOException {

        //AutoOperationContext autoOperationContext = new AutoOperationContext();
        //autoOperationContext.setOperator("07612"+ UUID.randomUUID().toString());
        //Page page=PlaywrightBase.getPage(autoOperationContext);
        //page.navigate("https://www.baidu.com/");
        //page.fill("#kw","java 随机数"+autoOperationContext.getOperator());
        //page.click("#su");
        //TesseractOcrUtil.testOcr();
       // executeOperationEvent(null, autoOperationContext, this);

        //InputStream input = downLoadInputStream.get("//*[@id=\"panel\"]/div[2]/div[1]/div[2]/table/tbody/tr/td[7]/button[2]");
        //
        //;
        //int index;
        //byte[] bytes = new byte[1024];
        //
        //FileOutputStream downloadFile = new FileOutputStream("D:\\a11.pdf");
        //while ((index = input.read(bytes)) != -1) {
        //    downloadFile.write(bytes, 0, index);
        //    downloadFile.flush();
        //}
        //input.close();
        //downloadFile.close();
        PlusAsyncFlowTestRequest plusAsyncFlowTestRequest=new PlusAsyncFlowTestRequest("");
        plusAsyncFlowTestManager.exec(plusAsyncFlowTestRequest, PlusAsyncFlowTestOperatorEnum.PlusAsyncFlowTest, PlusAsyncFlowTestResponse.class, PlusAsyncFlowTestContext.class);
        return "";

    }



}
